package main
import (
    "fmt"
    "encoding/json"
)

type Class struct {
	Title string `json:"title"`
	Students []Student `json:"students"`
}

type Student struct {
	Id string `json:"id"`
	Name string `json:"name"`
	Age int `json:"age"`
	Gender string `json:"gender"`
}

func main() {
	var str = `{"title":"Go语言","students":[{"id":"s0","name":"学生0","age":0,"gender":"男"},{"id":"s1","name":"学生1","age":1,"gender":"男"},{"id":"s2","name":"学生2","age":2,"gender":"男"},{"id":"s3","name":"学生3","age":3,"gender":"男"},{"id":"s4","name":"学生4","age":4,"gender":"男"},{"id":"s5","name":"学生5","age":5,"gender":"男"},{"id":"s6","name":"学生6","age":6,"gender":"男"},{"id":"s7","name":"学生7","age":7,"gender":"男"},{"id":"s8","name":"学生8","age":8,"gender":"男"},{"id":"s9","name":"学生9","age":9,"gender":"男"}]}`
	var class Class
	err := json.Unmarshal([]byte(str), &class)
	if err != nil {
		fmt.Println("json.Unmarshal failed, err:", err)
		return
	} 
	fmt.Printf("%#v\n", class)
	fmt.Printf("Title is: %v\n", class.Title)
}